#include "desktop.h"

// #include "../images/images.h"
// #include "../fonts/fonts.h"


MainPage::MainPage(/* args */)
{
  this->viewpoint = new Container(this);
  this->viewpoint->set_size(220, 260);
  this->viewpoint->set_bg_color(lv_color_hex(THEME_COLOR_BLUE), 0, LV_PART_MAIN | LV_STATE_DEFAULT);

  // 时间组件
  time_component = new Container(this->viewpoint);
  time_component->set_size(96, 96);
  // time_component->set_bg_color(lv_color_hex(THEME_COLOR_YELLOW), 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  time_component->set_pos(-4, 0);
  // time_component->set_flex_layout(LV_FLEX_FLOW_COLUMN, false, false, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);

  time_component->set_radius(10);

  Container* time_container = new Container(time_component);
  time_container->set_size(96, 48);
  time_container->set_flex_layout(LV_FLEX_FLOW_COLUMN, false, false, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);

  time_container->set_pos(-13, 2);

  Label* time_label = new Label(time_container);
  time_label->set_font(&lv_font_montserrat_28);
  time_label->set_text("12:34", THEME_COLOR_WHITE_PURE);

  Container* date_container = new Container(time_component);
  date_container->set_size(96, 32);
  date_container->set_flex_layout(LV_FLEX_FLOW_COLUMN, false, false, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
  date_container->set_pos(-13, 36);

  Label* date_label = new Label(date_container);
  date_label->set_font(&lv_font_montserrat_14);
  date_label->set_text("2021-02-25", THEME_COLOR_WHITE_PURE);

  // Label* week_label = new Label(date_container);
  // week_label->set_font(&ui_font_songti18);
  // week_label->set_text("星期四", THEME_COLOR_WHITE_PURE);


  // 电量组件
  battary_component = new Container(this->viewpoint);
  battary_component->set_size(96, 44);
  // battary_component->set_bg_color(lv_color_hex(THEME_COLOR_RED), 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  battary_component->set_pos(102, 0);
  battary_component->set_flex_layout(LV_FLEX_FLOW_ROW, false, false, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
  battary_component->set_radius(10);


  Image* battary_image = new Image(battary_component);
  battary_image->set_size(32, 32);
  battary_image->set_img(&ui_img_battery_png);

  Label* battary_label = new Label(battary_component);
  battary_label->set_font(&lv_font_montserrat_14);
  battary_label->set_text("100%", THEME_COLOR_WHITE_PURE);







  // 图片组件
  picture_component = new Container(this->viewpoint);
  picture_component->set_size(96, 96);
  picture_component->set_bg_color(lv_color_hex(THEME_COLOR_ORANGE), 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  picture_component->set_pos(102, 52);
  picture_component->set_radius(10);


  Image* picture_image = new Image(picture_component);
  picture_image->set_size(96, 96);
  picture_image->set_img(&ui_img_earth_png);

  // 天气组件
  weather_component = new Container(this->viewpoint);
  weather_component->set_size(96, 44);
  // weather_component->set_bg_color(lv_color_hex(THEME_COLOR_CYAN), 0, LV_PART_MAIN | LV_STATE_DEFAULT);
  weather_component->set_pos(-4, 104);
  weather_component->set_flex_layout(LV_FLEX_FLOW_ROW, false, false, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);

  Image* weather_image = new Image(weather_component);
  weather_image->set_size(32, 29);
  weather_image->set_img(&ui_img_sunny_png);

  Container* weather_label_container = new Container(weather_component);
  weather_label_container->set_size(44, 42);
  weather_label_container->set_bg_color(lv_color_hex(THEME_COLOR_WHITE_PURE), 0, LV_PART_MAIN | LV_STATE_DEFAULT);
  // weather_label_container->set_flex_layout(LV_FLEX_FLOW_COLUMN, false, false, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);

  Label* weather_label_temp = new Label(weather_label_container);
  weather_label_temp->set_font(&lv_font_montserrat_14);
  weather_label_temp->set_text("25 C", THEME_COLOR_WHITE_PURE);
  weather_label_temp->set_pos(0, -9);


  Label* weather_label_humimdity = new Label(weather_label_container);
  weather_label_humimdity->set_font(&lv_font_montserrat_14);
  weather_label_humimdity->set_text("87%", THEME_COLOR_WHITE_PURE);
  weather_label_humimdity->set_pos(0, 9);


  // 通知组件
  notify_component = new Container(this->viewpoint);
  notify_component->set_size(204, 48);
  notify_component->set_bg_color(lv_color_hex(THEME_COLOR_WHITE), 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  notify_component->set_pos(-4, 156);

  Label* notify_label = new Label(notify_component);
  notify_label->set_font(&ui_font_songti18);
  notify_label->set_text("你好!我是AI机器人娜娜", THEME_COLOR_WHITE_PURE);

  // AI组件
  ai_component = new Container(this->viewpoint);
  ai_component->set_size(204, 32);
  ai_component->set_bg_color(lv_color_hex(THEME_COLOR_WHITE), 0, LV_PART_MAIN | LV_STATE_DEFAULT);
  ai_component->set_pos(-4, 210);
  ai_component->set_flex_layout(LV_FLEX_FLOW_ROW, false, false, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);

  // AI按钮
  ai_btn = new Button(ai_component);
  ai_btn->set_size(72, 24);
  ai_btn->set_bg_color(lv_color_hex(THEME_COLOR_WHITE_PURE), 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  ai_btn->set_pos(0, 0);
  ai_btn->set_text("AI", THEME_COLOR_RED);




}

MainPage::~MainPage(/* args */)
{

}